<?php

/*
 * 邮费配置数据类
 */
class Application_Model_DbTable_shipFeeConfig extends Application_Model_DbTable_DomainObject{
    
        protected $_name = 'uuch_shipFeeConfig';	
        
	public function getMapper(){
		return array('id','cityid','shipTypeId','agentCompanyId','discount','price','uuprice','weight','startweight','startPrice','uustartPrice','queryurl','oil','clearancePrice','pushTime','state','times');
	}
        
        /*
         * 根据城市序号获取信息
         */
        public function  getbyCityid($Cityid,$sort='startweight desc'){
            $db = $this->getAdapter();
            $filter = $db->quoteInto(' cityid = ?', $Cityid);            
            $rows = $this->fetchAll($filter,$sort);
            
            $result = array();
            foreach ($rows as $row){
                array_push($result,$this->convertRowToObject($row));                    
            }           
            return $result;
        }
        
        /*
         * 根据物流公司获取区域物流信息
         */
        public function  getbyType($shipTypeId){
            $db = $this->getAdapter();
            $filter = $db->quoteInto(' shipTypeId = ?', $shipTypeId);            
            $rows = $this->fetchAll($filter,"cityid");
            
            $result = array();
            foreach ($rows as $row){
                array_push($result,$this->convertRowToObject($row));                    
            }           
            return $result;
        }
        
        /*
         * 根据物流公司、城市获取运费信息
         */
        public function  getbyCityType($Cityid,$shipTypeId){
            $db = $this->getAdapter();
            $filter = $db->quoteInto(' cityid = ?', $Cityid);           
            $filter .= $db->quoteInto(' and shipTypeId = ?', $shipTypeId);            
            $rows = $this->fetchAll($filter,"uustartPrice desc");
            
            $result = array();
            foreach ($rows as $row){
                array_push($result,$this->convertRowToObject($row));                    
            }           
            return $result;
        }
}
?>
